package com.test.platform.module.perf.controller;

import com.test.common.response.ResponseResult;
import com.test.platform.module.perf.service.PerfReportService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@Api(value = "value", tags = "性能平台报告管理")
@RestController
@RequestMapping("/perf/report")
@ResponseResult
public class PerfReportController {

    @Resource
    private PerfReportService perfReportService;

    @GetMapping("/stop")
    public Object stop(int id) {
        return perfReportService.stop(id);
    }

    @GetMapping("/finish")
    public Object finish(String uuid) {
        return perfReportService.finish(uuid);
    }

    @GetMapping("/getDetail")
    public Object getDetail(@RequestParam("id") int id, @RequestParam("count") int count, @RequestParam("interval") int interval) {
        return perfReportService.getReportDetail(id, count, interval);
    }

    @GetMapping("/searchAll")
    public Object searchAll(int pageNo, int pageSize) {
        return perfReportService.searchAll(pageNo, pageSize);
    }

    @GetMapping("/countByStatus")
    public Object countByStatus() {
        return perfReportService.countByStatus();
    }

    @GetMapping("/reExecution")
    public Object reExecution(int reportId, int users, int qps, String remark) {
        return perfReportService.reExecution(reportId, users, qps, remark);
    }

    @GetMapping("/delete")
    public Object delete(int reportId) {
        return perfReportService.delete(reportId);
    }
}
